<template>
	<view class="consult">
		<u-navbar :is-back="false" :placeholder="true" title="测评"></u-navbar>
		<view class="bg"></view>
		<scroll-view :style="{ height: domHeight }" class="scrollWrap" :enhanced="true" scroll-y :bounces="false" :show-scrollbar="false">
			<!-- <view class="head">
				<view class="con">
					<view>测评</view>
					<view>
						<image @click="handelSearch" src="@/static/newImg/index/search.svg"></image>
						<image @click="handelMyEvaluate" src="@/static/newImg/index/heart.svg"></image>
					</view>
				</view>
			</view> -->
			<view class="box-con">
				<cc-twoCate
					ref="twoCate"
					:classList="categoryList"
					:currentTypeId="currentTypeId"
					:hideShow="true"
					@itemClick="itemClick"
					@itemClickDetail="itemClickDetail"
				></cc-twoCate>
			</view>
		</scroll-view>
	</view>
</template>

<script>
import { getCategoryList } from '@/api/evaluate/index.js';
export default {
	data() {
		return {
			categoryList: [],
			currentTypeId: 0,
			domHeight: '',
			newcurrentTypeId: 0
		};
	},
	components: {},
	onShareAppMessage() {
		return {
			title: '仰望心理'
			// ...其他配置
		};
	},
	onLoad() {},
	onShow() {
		this.newcurrentTypeId = uni.getStorageSync('currentTypeId');
		getCategoryList().then((res) => {
			this.categoryList = res.rows;
			this.currentTypeId = this.newcurrentTypeId ? this.newcurrentTypeId : this.categoryList[0].id;
			// this.currentTypeId = this.categoryList[0].id;
			this.$refs.twoCate.refreshList();
			uni.removeStorageSync('currentTypeId');
		});
	},
	methods: {
		itemClickDetail(item) {
			//获取点击的列表项
			this.$tab.navigateTo(`/subset/pages/evaluate/evaluateDetail?id=${item.id}`);
		},

		itemClick(e) {
			//点击的左侧类型
			this.currentTypeId = e.id;
		},
		handelSearch() {
			this.$tab.navigateTo(`/subset/pages/evaluate/search/index`);
		},
		handelMyEvaluate() {
			this.$tab.navigateTo(`/subset/pages/evaluate/search/myEvaluate`);
		}
	},
	mounted() {
		this.domHeight = uni.getStorageSync('domHeight');
	}
};
</script>

<style scoped lang="scss">
@import url('@/static/font/navBar.less');
.consult {
	width: 100%;
	height: 100%;
	position: relative;
	background-color: #f6f7ff;
	.bg {
		width: 100%;
		height: 40%;
		background: linear-gradient(127deg, #a4dcb3 0%, #ffeed6 37%, #d3fffb 100%);
		border-radius: 0rpx 0rpx 80rpx 80rpx;
		position: fixed;
		top: 0;
	}
	.scrollWrap {
		width: 100%;
		padding-bottom: 20rpx;
	}
	.head {
		width: 100%;
		height: 88rpx;
		position: relative;

		.bg {
			width: 100%;
			height: 100%;
			position: absolute;
			left: 0;
			top: 0;
		}

		.con {
			width: 100%;
			height: 100%;
			position: absolute;
			left: 0;
			top: 0;
			padding: 24rpx 60rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;

			> view:nth-child(1) {
				font-weight: bold;
				font-size: 32rpx;
				color: #333333;
			}

			> view:nth-child(2) {
				image:nth-child(1) {
					width: 37rpx;
					height: 40rpx;
					margin-right: 60rpx;
				}

				image:nth-child(2) {
					width: 36rpx;
					height: 39rpx;
				}
			}
		}
	}
	.content {
		display: flex;
		flex-direction: column;
	}
	.box-con {
		width: 100%;
		height: calc(100% - 88rpx);
		position: relative;
		background-color: #f6f7ff;
	}
}
</style>
